﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

public class HttpExample : MonoBehaviour
{
    private void Awake()
    {
        HttpPool.AddRequest(new HttpRequest 
        { 
             requestType = RequestType.GET,
             url = "https://blog.csdn.net/",
             taskCompletionSource = new TaskCompletionSource<UnityWebRequest>
             {
                 onCompleted = (request) => 
                 {
                     Debug.LogError(request.downloadHandler.text);
                 }
             }
        });

        HttpPool.AddRequest(new HttpRequest
        {
            requestType = RequestType.GET,
            url = "https://www.baidu.com/",
            taskCompletionSource = new TaskCompletionSource<UnityWebRequest>
            {
                onCompleted = (request) =>
                {
                    Debug.LogError(request.downloadHandler.text);
                }
            }
        });
    }
}
